let collectApp = new Vue({
    el:"#collectApp",
    data:{
        pageSize:2,
        questions:[],
        pageInfo:{},
        isShow:false
    },
    methods:{
        loadCollect(pageNum){
            axios.get('/portal/question/collect?pageNum='+pageNum+'&pageSize='+this.pageSize)
                .then(result=>{
                    let r = result.data
                    if(r.code==OK){
                        if(r.data.list.length==0){
                            this.isShow = true
                            return
                        }
                        this.isShow=false
                        this.pageInfo = r.data
                        this.questions = r.data.list
                    }
                })
        },
        cancelCollect(Id,index){
            let flag = confirm("是否确定删除")
            if(flag) {
                axios.get('/portal/userCollect/cancel/' + Id)
                    .then(result => {
                        let r = result.data;
                        if(r.code==OK){
                            this.questions.splice(index,1)
                            alert("删除成功")
                        }

                    })
                //this.loadCollect(1)
            }
        }
    },
    created(){
        this.loadCollect(1)
    }
})